<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>prop_attrs</title>
    <script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script>
</head>
<body>
    <div id="app">
        <base-input
            v-model="username"
            required
            placeholder="Enter your username"
            v-on:keyupenter="mykeyupenter"
        ></base-input>
    </div>
    <script>
        Vue.component('base-input', {
            inheritAttrs: false,
            props: ['label', 'value'],
            template: `
                <label>
                    {{ label }}
                    <input
                        v-bind="$attrs"
                        v-bind:value="value"
                        v-on:input="$emit('input', $event.target.value)"
                        v-on:keyup.enter="$emit('keyupenter', $attrs)"
                    >
                </label>
            `
        });
        var app = new Vue({
            el: '#app',
            data: {
                username: ''
            },
            methods: {
                mykeyupenter(){
                    var args = Array.prototype.slice(arguments);
                    console.log(args);
                }
            }
        });
    </script>
</body>
</html>
